// exercise模块树形结构递归封装
export function transListToTreeData (list, v) {
  var arr = []
  //   console.log(list, 'vvvvv', v)
  list.forEach(i => {
    // console.log('iiiiiiiiiiiiiiiiiiiii', i)
    if (i.pid === v) {
      const children = transListToTreeData(list, i.id)
      if (children.length) {
        i.children = children
      }
      arr.push(i)
    }
  })
  return arr
}
